﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master/AdminMaster.Master"
    AutoEventWireup="true" CodeBehind="HospitalGoodsWeiShenHe.aspx.cs" Inherits="HZ.DrugTrade.Web.Admin.BidProdManage.HospitalGoodsWeiShenHe" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="tabnav">
        <ul>
            <li id="isloginno" class="active"><a href="HospitalGoodsWeiShenHe.aspx?IsLogin=1">医疗机构填报未审核产品</a></li>
            <li id="Li1"><a href="HospitalGoodsShenHe.aspx?IsLogin=1">医疗机构填报已审核产品</a></li>
        </ul>
    </div>
    <div id="tabcontent">
        <table class="querylist">
            <tr>
                <td>
                    <table class="querylist">
                        <tr>
                            <td align="right">
                                产品名称：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtGoodsName" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                规格型号：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtOutLook" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                材质：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtMaterial" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                产品编号：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtGoodsID" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                生产企业：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtCompanyName_Sc" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                医疗机构名称：
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddl_hospital" runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="100px">
                    <hz:HzButton ID="btnQuery" runat="server" Text="查询" OnClick="btnQuery_Click" CssClass="searchbtn" />
                </td>
            </tr>
        </table>
    </div>
    <asp:GridView runat="server" ID="gvwNoConfirm" AutoGenerateColumns="False" CssClass="mainlist"
        EmptyDataText="无未确认产品！" OnRowDataBound="gvwNoConfirm_RowDataBound" DataKeyNames="GoodsId">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <input id="addTable_chkAll" name="chkAll" type="checkbox" onclick="SelectAllCheckboxes(this,'ctl00_ContentPlaceHolder1_gvwNoConfirm','addTable_chkAll'); " />
                </HeaderTemplate>
                <ItemTemplate>
                    <input type="checkbox" name="checkbox1" id="checkbox1" value='<%#Eval("HospitalID")%>'
                        onclick="chkChecked(this,'ctl00_ContentPlaceHolder1_gvwNoConfirm','addTable_chkAll');"
                        runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="序号">
                <ItemTemplate>
                    <%#Container.DataItemIndex + 1 + AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex-1) %>
                </ItemTemplate>
                <HeaderStyle Width="30px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="流水号">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblGoodsID" Text='<%# Eval("GoodsId") %>'></asp:Label>
                    <asp:HiddenField ID="hidPrice" Value='<%# Eval("Price") %>' runat="server" />
                    <asp:HiddenField ID="hiCount" Value='<%# Eval("CountProduces") %>' runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="GoodsName" HeaderText="产品名称" />
            <asp:BoundField DataField="Outlookc" HeaderText="规格型号" />
            <asp:BoundField DataField="Material" HeaderText="材质" NullDisplayText="无" />
            <asp:BoundField DataField="Unit" HeaderText="最小计量单位" />
            <asp:BoundField DataField="PackUnit" HeaderText="包装单位" />
            <asp:BoundField DataField="QualityLevel" HeaderText="产品类别" />
            <asp:BoundField DataField="HospitalName" HeaderText="医疗机构名称" />
            <asp:BoundField DataField="HospitalID" HeaderText="医疗机构编号" />
            <asp:BoundField DataField="CompanyName_SC" HeaderText="生产企业" />
            <asp:TemplateField HeaderText="确认价格" ControlStyle-Width="150px">
                <ItemTemplate>
                    <asp:Label ID="showMessage" runat="server"></asp:Label>
                </ItemTemplate>
                <ControlStyle Width="150px"></ControlStyle>
                <ItemStyle Width="150px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="采购数量">
                <ItemTemplate>
                    <asp:Label ID="lblMessage" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作"></asp:TemplateField>
            <asp:TemplateField HeaderText="提交状态">
                <ItemTemplate>
                    <asp:Label ID="lblState" runat="server" Text='<%# Eval("goodsState").ToString()=="2"?"已提交":"未提交"%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Price" HeaderText="确认价格" Visible="false" />
            <asp:BoundField DataField="CountProduces" HeaderText="采购数量" Visible="false" />
        </Columns>
    </asp:GridView>
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_OnPageChanged">
        </webdiyer:AspNetPager>
    </div>
    <div class="listip" style="display: none;">
        <ul>
            <li>说明：li&gt; listctrl&quot;&gt; server" Text="撤 单" CssClass="btn" OnClientClick=" if(checkSelectedItems('ctl00_ContentPlaceHolder1_gvwNoConfirm','请至少选定一个采购明细！'))
                {return confirm('确实要撤除选定的采购明细？');}return false;" OnClick="btnAbandon_Click" ToolTip="撤销所选的采购明细"
                />--%>
                <hz:HzButton ID="btnExport" runat="server" Text="导出Excel" CssClass="btn" ToolTip="到处Excel"
                    OnClick="btnExport_Click" />
    </div>
    <div class="listctrl">
        <hz:HzButton ID="HzButton1" runat="server" Text="导出Excel" CssClass="btn" ToolTip="到处Excel"
            OnClick="btnExport_Click" />&nbsp;&nbsp;&nbsp;
        <hz:HzButton ID="HzBtnDelete" runat="server" Text="删 除" CssClass="btn" OnClick="HzBtnDelete_Click" />&nbsp;&nbsp;&nbsp;
        <hz:HzButton ID="btn_submit" runat="server" Text="提交数据审核" CssClass="btn" OnClientClick="return confirm('提交后的数据将不能再做修改！')"
            onclick="btn_submit_Click" />&nbsp;&nbsp;&nbsp;
    </div>
    <script type="text/javascript">

        //保存数据
        function SavePrice(txtPrice, goodsID, Hospital, txtcount) {

            var price = document.getElementById(txtPrice).value;
            //            alert(price);
            var count = document.getElementById(txtcount).value;
            if (price == "") {
                alert("价格不能为空！"); return false;
            }

            if (!isNum(price)) {
                alert("请填写数字！"); return false;
            }
            price = changeTwoDecimal_f(price);
            if (price == "0.00") {
                alert("价格不能为0！"); return false;
            }
            if (price <= 0) {
                alert("价格不能为负数！"); return false;
            }

            if (count.indexOf(".", 0) > 0) {
                alert("采购数量请输入整数！请检查"); return false;
            }
            if (!isNum(count)) {
                alert("采购数量请输入数字！请检查"); return false;
            }

            if (count < 0) {
                alert("采购数量不能为负数！请检查"); return false;
            }
            if (count == 0 || count == "") {
                alert("采购数量不能为0！请检查"); return false;
            }
            //提交数据
            $.ajax({
                type: "Post",
                url: "../../Hospitals/Procurement/HospitalLoginPrice.ashx",
                data: "GoodsID=" + goodsID + "&HospitalID=" + Hospital + "&price=" + price + "&CountProduces=" + count,
                beforeSend: function () { },
                complete: function () { },
                error: function (data) { alert(data.responseText); },
                success: function (data) {
                    if (data == "1") {
                        alert("保存成功");
                    }
                    else {
                        alert("保存失败，请重试");
                    }
                }

            });
        }




        function isNum(NumLook) {
            if (!isNaN(NumLook)) { return true; }
            else { return false; }
        }
        function changeTwoDecimal_f(x) {
            var f_x = parseFloat(x);
            var f_x = Math.round(x * 100) / 100;
            var s_x = f_x.toString();
            var pos_decimal = s_x.indexOf('.');
            if (pos_decimal < 0) {
                pos_decimal = s_x.length;
                s_x += '.';
            }
            while (s_x.length <= pos_decimal + 2) {
                s_x += '0';
            }
            return s_x;
        }

    </script>
</asp:Content>
